<section id="signin_main" class="authenty signin-main">
    <div class="section-content">
        <div class="wrap">
            <div class="container" >	  
                <div class="form-wrap">
                    <div class="row"  id="loadlogin">

                        <div id="form_1">
                            <div class="form-header">
                                <i class="fa fa-user"></i>
                            </div>
                            <div class="form-main">

                                <div class="form-group">
                                    <input type="text" id="username" class="form-control" placeholder="Nhập tên tài khoản" required="required">
                                    <input type="password" id="passwordcheck" class="form-control" placeholder="Nhập mật khẩu" required="required">
                                </div>
                                <button onclick="checklogin();" id="signIn_1" type="submit" class="btn btn-block signin">Đăng nhập</button>

                            </div>
                            <div class="form-footer">
                                <div class="row">
                                    <i id="meslogin" style="color: #FFF">

                                    </i>
                                </div>
                            </div>		
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
 <input type="hidden" value="<?php echo WEB_PATH; ?>" id="url"/>
<script>
    function checklogin() {

        var url = $("#url").val() + "/cpadmin/login";
        var username = $("#username").val();
        var password = $("#passwordcheck").val();
        $.ajax({
            url: url,
            type: "POST",
            data: "btn=action&username=" + username + "&password=" + password,
            success: function(dataserver) {
                var data = dataserver.split("*duypc*");
                var check = data[0];
                if (check == "10") {
                    var url = data[1];
                        $(location).attr('href', url);
                } else {
                    if (check == "5") {
                        var url = data[1];
                        $(location).attr('href', url);
                    } else {
                        $("#loadlogin").toggle("shake");
                        $("#loadlogin").toggle("shake");
                        $("#meslogin").html("Tên đăng nhập hoặc mật khẩu không chính xác.");

                    }
                }
                return false;
            }
        });
        return false;
    }
</script>